import BaseService from '../BaseService'
import factory from '../serviceFactory'
import SystemConstant from '@/constants/System'
import qs from 'qs'
const ctx = SystemConstant.CTX
class AirRefundService extends BaseService {
  /**
   * 退票翻页列表
   * queryOrderPage({ ... })
   */
  queryOrderPage = factory.makeGet('/api/airRefund/queryOrderPage')

  /**
   * 退票单详情
   * detail({ refundId })
   */
  detail = factory.makeGet('/api/airRefund/detail')

  /**
   * 退票单状态修改
   * changeStatus({ refundId, status })
   */
  changeStatus = factory.makeJPost('/api/airRefund/changeStatus')

  /**
   * 确认
   * confirm({ refundId })
   */
  confirm = factory.makeJPost('/api/airRefund/confirm')

  /**
   * 拒绝
   * reject({ refundId, rejectType })
   */
  reject = factory.makePost('/api/airRefund/reject')

  /**
   * 保存
   * save({...})
   */
  save = factory.makeJPost('/api/airRefund/save')

  /**
   * 提交航司
   * submitToAirline({...})
   */
  submitToAirline = factory.makeJPost('/api/airRefund/submitToAirline')

  autoRefund = factory.makeJPost('/api/airRefund/autoRefund')

  /**
   * 退票单日志
   * getLogs({refundId})
   */
  getLogs = factory.makeGet('/api/airRefund/getLogs')

  /**
   * 同列表查询
   * countByStatus(...)
   */
  countByStatus = factory.makeGet('/api/airRefund/countByStatus')

  /**
   * 同列表查询
   * 根据pnr获取退票单信息(...)
   */
  getRefundInfoByPnr = factory.makeGet('/api/airRefund/getRefundInfoByPnr')

  /**
   * 取消已出票的PNR
   * cancelPnr({refundId, pnr, remark})
   */
  cancelPnr = factory.makePost('/api/airRefund/cancelPnr')

  /**
   * 取消已出票的PNR
   * toSubmitAirline({refundId, pnr, remark})
   */
  toSubmitAirline = factory.makePost('/api/airRefund/toSubmitAirline')
  /**
  *删除退票单
  */
  delete = factory.makePost('/api/airRefund/delete')

  /**
   * 退票-导出
   * @param params
   */
  exportReport = function (params) {
    return ctx + '/api/airRefund/exportReport?' + qs.stringify(params)
  }
  /**
   * 获取最晚取消PNR时间
   */
  getLatestCancelPnrTime = factory.makeJPost('/api/airRefund/getLatestCancelPnrTime')
}

export default new AirRefundService()
